﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace XhPaper
{
    public class MyXmlTableJdq:IMyInterface
    {
        string[] m_jdName = new string[] {"1","2","3","4","13","23","11","21","12","22","33","43","31","41","32","42",
                                          "53","63","51","61","52","62","73","83","71","81","72","82","板号",
                                          "类型","位置","name"};
        string m_filename;
        XmlElement m_xmlRoot;
        System.Drawing.Rectangle m_myRect;
        public System.Drawing.Rectangle MyRect
        {
            get { return m_myRect; }
            set { m_myRect = value; }
        }
        public XmlElement XmlRoot
        {
            get { return m_xmlRoot; }
            set { m_xmlRoot = value; }
        }
        public string FileName
        {
            get
            {
                return m_filename;
            }
            set
            {
                m_filename = value;
            }
        }
        double m_wide1;
        public double Wide1
        {
            get { return m_wide1; }
            //set { m_wide1 = value; }
        }

        double m_wide2;
        public double Wide2
        {
            get { return m_wide2; }
            //set { m_wide2 = value; }
        }

        double m_wide3;
        public double Wide3
        {
            get { return m_wide3; }
            //set { m_wide3 = value; }
        }

        double[] m_line1xs;
        public double[] Line1xs
        {
            get { return m_line1xs; }
            //set { m_line1xs = value; }
        }

        double[] m_line2xs;
        public double[] Line2xs
        {
            get { return m_line2xs; }
            // set { m_line2xs = value; }
        }

        double[] m_liexs;
        public double[] Liexs
        {
            get { return m_liexs; }
            //set { m_liexs = value; }
        }
        public MyXmlTableJdq()
        {
            GetDataFromXml();
        }
        XmlElement GetXmlRoot()
        {
            if (XmlRoot == null)
            {
                XmlDocument xmlDoc = new XmlDocument();
                string filename = System.IO.Directory.GetCurrentDirectory() + "\\jdqXMLFile1.xml";
                xmlDoc.Load(filename);
                XmlRoot = xmlDoc.DocumentElement;
            }
            return XmlRoot;
        }
        public double[] GetDoubles(string s)
        {
            char[] ch = new char[] { ',' };
            double[] d;
            string[] str = s.Split(ch, StringSplitOptions.RemoveEmptyEntries);
            d = new double[str.Length];
            for (int i = 0; i < str.Length; i++)
            {
                double.TryParse(str[i], out d[i]);
            }
            return d;
        }
        #region 实现接口
        public void GetDataFromXml()
        {
            if (XmlRoot == null)
            {
                GetXmlRoot();
            }
            XmlNodeList nodeList2;
            #region 得到wide
            nodeList2 = m_xmlRoot.SelectNodes("gridwide");
            if (nodeList2.Count > 0)
            {
                double.TryParse(nodeList2.Item(0).Attributes["wide1"].Value, out m_wide1);
                double.TryParse(nodeList2.Item(0).Attributes["wide2"].Value, out m_wide2);
                double.TryParse(nodeList2.Item(0).Attributes["wide3"].Value, out m_wide3);
            }
            #endregion
            #region 得到hang data
            nodeList2 = m_xmlRoot.SelectNodes("hang");
            if (nodeList2.Count > 0)
            {
                m_line1xs = GetDoubles(nodeList2.Item(0).Attributes["line1x"].Value);
                m_line2xs = GetDoubles(nodeList2.Item(0).Attributes["line2x"].Value);
            }
            #endregion
            #region 得到lie data
            nodeList2 = m_xmlRoot.SelectNodes("lie");
            if (nodeList2.Count > 0)
            {
                m_liexs = GetDoubles(nodeList2.Item(0).Attributes["x"].Value);
            }
            #endregion
        }
        public List<MyLine> GetLieLines(MyAutoCadObjectBase container)
        {
            List<MyLine> lieLines = new List<MyLine>();
            MyPoint p1, p2;
            MyLine line;
            for (int i = 0; i < Liexs.Length; i++)
            {
                switch (i)
                {
                    case 0:
                    case 4:
                        p1 = new MyPoint(Liexs[i], 0, container);
                        p2 = new MyPoint(Liexs[i], -15 * Wide1, container);
                        break;
                    case 5:
                        p1 = new MyPoint(Liexs[i], 0, container);
                        p2 = new MyPoint(Liexs[i], Wide1 * (-1), container);
                        break;
                    default:
                        p1 = new MyPoint(Liexs[i], Wide1 * (-1), container);
                        p2 = new MyPoint(Liexs[i], -15 * Wide1, container);
                        break;
                }
                line = new MyLine(p1, p2, container);
                lieLines.Add(line);
            }
            return lieLines;
        }

        public List<MyLine> GetHangLines(MyAutoCadObjectBase container)
        {
            List<MyLine> hangLines = new List<MyLine>();
            MyPoint p1, p2;
            MyLine line;
            for (int i = 0; i < 16; i++)
            {
                p1 = new MyPoint(Line1xs[0], -1 * i * Wide1, container);
                p2 = new MyPoint(Line1xs[1], -1 * i * Wide1, container);
                line = new MyLine(p1, p2, container);
                hangLines.Add(line);
            }
            p1 = new MyPoint(Line2xs[0], -1 *  Wide2, container);
            p2 = new MyPoint(Line2xs[1], -1 *  Wide2, container);
            line = new MyLine(p1, p2, container);
            hangLines.Add(line);
         
            return hangLines;
        }

        public List<MyLine> GetQiTaLines(MyAutoCadObjectBase container)
        {
            return null;
        }

        public System.Drawing.Rectangle GetRectangle(MyAutoCadObjectBase container)
        {
            #region 得到矩形坐标
            double top, left, width, heigh;
            XmlNodeList nodeList = XmlRoot.SelectNodes("RECT");
            if (nodeList.Count > 0)
            {
                double.TryParse(nodeList.Item(0).Attributes["Top"].Value, out top);
                double.TryParse(nodeList.Item(0).Attributes["Left"].Value, out left);
                double.TryParse(nodeList.Item(0).Attributes["WIDTH"].Value, out width);
                double.TryParse(nodeList.Item(0).Attributes["HEIGHT"].Value, out heigh);
                MyRect = new System.Drawing.Rectangle((int)left, (int)(top), (int)width, (int)heigh);
            }
            #endregion
            return MyRect;
        }

        public void GetNameTextDic(MyAutoCadObjectBase container,out Dictionary<string, MyText> m_jdqNameDic, out Dictionary<string, MyText> m_jdqTextDic)
        {
            m_jdqNameDic = new Dictionary<string, MyText>();
            m_jdqTextDic = new Dictionary<string, MyText>();
            #region 配置继电器接点相关文字的有关坐标信息
            MyText text;
            MyPoint myPoint;
            for (int i = 0; i < m_jdName.Length; i++)
            {
                if (i < 29)
                {
                    myPoint = new MyPoint(Liexs[i % 2 == 0 ? 0 : 2], (i/2-15)*Wide1, container);
                    text = new MyText(myPoint, m_jdName[i], container);
                    m_jdqNameDic.Add(m_jdName[i], text);
                    myPoint = new MyPoint(Liexs[i % 2 == 0 ? 1 : 3], (i/2 - 15) * Wide1, container);
                    text = new MyText(myPoint, string.Empty, container);
                    m_jdqTextDic.Add(m_jdName[i], text);
                }
                else
                {
                    switch (i)
                    {
                        case 29:
                            myPoint = new MyPoint(Liexs[5], -1*Wide1, container);
                            text = new MyText(myPoint, m_jdName[i], container);
                            m_jdqNameDic.Add(m_jdName[i], text);
                            break;
                        case 30:
                            myPoint = new MyPoint(Liexs[0], -1 * Wide2, container);
                            text = new MyText(myPoint, m_jdName[i], container);
                            m_jdqNameDic.Add(m_jdName[i], text);
                            break;
                        case 31:
                            myPoint = new MyPoint(Liexs[5], -1 * Wide2, container);
                            text = new MyText(myPoint, m_jdName[i], container);
                            m_jdqNameDic.Add(m_jdName[i], text);
                            break;
                    }
                }
            }
            #endregion
        }
        #endregion
    }
    public class MyXmlTableJkb : IMyInterface
    {
        string[] m_jkName = new string[] { "name", "style", "接口板", "安装位置", "名称", "采集位置", "输出信号", "工作电源" };

        public string[] JkName
        {
            get { return m_jkName; }
           // set { m_jkName = value; }
        }

        double m_wide1;
        public double Wide1
        {
            get { return m_wide1; }
            //set { m_wide1 = value; }
        }

        double m_wide2;
        public double Wide2
        {
            get { return m_wide2; }
            //set { m_wide2 = value; }
        }

        double m_wide3;
        public double Wide3
        {
            get { return m_wide3; }
            //set { m_wide3 = value; }
        }

        double[] m_line1xs;
        public double[] Line1xs
        {
            get { return m_line1xs; }
            //set { m_line1xs = value; }
        }

        double[] m_line2xs;
        public double[] Line2xs
        {
            get { return m_line2xs; }
           // set { m_line2xs = value; }
        }

        double[] m_liexs;
        public double[] Liexs
        {
            get { return m_liexs; }
            //set { m_liexs = value; }
        }

        int m_jkbItemCount;
        public int JkbItemCount
        {
            get { return m_jkbItemCount; }
            set { m_jkbItemCount = value; }
        }

        XmlElement m_xmlRoot;
        public XmlElement XmlRoot
        {
            get { return m_xmlRoot; }
            set { m_xmlRoot = value; }
        }

        public string FileName
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public MyXmlTableJkb(int count)
        {
            m_jkbItemCount = count;
            GetDataFromXml();
        }
        XmlElement GetXmlRoot()
        {
            if (XmlRoot == null)
            {
                XmlDocument xmlDoc = new XmlDocument();
                string filename = System.IO.Directory.GetCurrentDirectory() + "\\jkbXMLFile1.xml";
                xmlDoc.Load(filename);
                XmlRoot = xmlDoc.DocumentElement;
            }
            return XmlRoot;
        }
        
        public double[] GetDoubles(string s)
        {
            char[] ch = new char[] { ',' };
            double[] d;
            string[] str = s.Split(ch, StringSplitOptions.RemoveEmptyEntries);
            d = new double[str.Length];
            for (int i = 0; i < str.Length; i++)
            {
                double.TryParse(str[i], out d[i]);
            }
            return d;
        }
        #region 接口
        public  void GetDataFromXml()
        {
            if (XmlRoot == null)
            {
                GetXmlRoot();
            }
            XmlNodeList nodeList2;
            #region 得到wide
            nodeList2 = m_xmlRoot.SelectNodes("gridwide");
            if (nodeList2.Count > 0)
            {
                double.TryParse(nodeList2.Item(0).Attributes["wide1"].Value, out m_wide1);
                double.TryParse(nodeList2.Item(0).Attributes["wide2"].Value, out m_wide2);
                double.TryParse(nodeList2.Item(0).Attributes["wide3"].Value, out m_wide3);
            }
            #endregion
            #region 得到hang data
            nodeList2 = m_xmlRoot.SelectNodes("hang");
            if (nodeList2.Count > 0)
            {
                m_line1xs = GetDoubles(nodeList2.Item(0).Attributes["line1x"].Value);
                m_line2xs = GetDoubles(nodeList2.Item(0).Attributes["line2x"].Value);
            }
            #endregion
            #region 得到lie data
            nodeList2 = m_xmlRoot.SelectNodes("lie");
            if (nodeList2.Count > 0)
            {
                m_liexs = GetDoubles(nodeList2.Item(0).Attributes["x"].Value);
            }
            #endregion

        }
        public virtual List<MyLine> GetLieLines(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }

        public virtual List<MyLine> GetHangLines(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }

        public virtual List<MyLine> GetQiTaLines(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }

        public virtual void GetNameTextDic(MyAutoCadObjectBase container, out Dictionary<string, MyText> m_jdqNameDic, out Dictionary<string, MyText> m_jdqTextDic)
        {
            throw new NotImplementedException();
        }

        public virtual System.Drawing.Rectangle GetRectangle(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }
        #endregion
    }
    public class MyXmlTableJkb1 : MyXmlTableJkb
    {
        public MyXmlTableJkb1(int count)
            : base(count)
        {
        }
        #region 接口
        public override List<MyLine> GetLieLines(MyAutoCadObjectBase container)
        {
            MyPoint p1, p2;
            MyLine line;
            List<MyLine> listLine = new List<MyLine>();
            double a = Wide1 + Wide2;
            for (int i = 0; i < Liexs.Length; i++)
            {
                switch (i)
                {
                    case 0:
                    case 8:
                        p1 = new MyPoint(Liexs[i], 0, container);
                        p2 = new MyPoint(Liexs[i], 0-(Wide3 * JkbItemCount+a), container);
                        line = new MyLine(p1, p2, container);
                        break;
                    case 4:
                    case 6:
                        p1 = new MyPoint(Liexs[i], 0-a, container);
                        p2 = new MyPoint(Liexs[i], (0-a)-(Wide3 * JkbItemCount), container);
                        line = new MyLine(p1, p2, container);
                        break;
                    default:
                        p1 = new MyPoint(Liexs[i], 0-Wide1, container);
                        p2 = new MyPoint(Liexs[i], (0-Wide1)-(Wide3 * JkbItemCount+Wide2), container);
                        line = new MyLine(p1, p2, container);
                        break;
                }
                listLine.Add(line);
            }
            return listLine;
        }

        public override List<MyLine> GetHangLines(MyAutoCadObjectBase container)
        {
            List<MyLine> listLines = new List<MyLine>();
            MyLine line;
            MyPoint p1, p2;
            p1 = new MyPoint(Line1xs[0], 0, container);
            p2 = new MyPoint(Line1xs[1], 0, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            p1 = new MyPoint(Line1xs[0], 0 - Wide1, container);
            p2 = new MyPoint(Line1xs[1], 0 - Wide1, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            p1 = new MyPoint(Line1xs[0], 0 - Wide1 - Wide2, container);
            p2 = new MyPoint(Line1xs[1], 0 - Wide1 - Wide2, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            double b = 0 - Wide1 - Wide2;
            for (int i = 1; i < JkbItemCount+1; i++)
            {
                p1 = new MyPoint(Line1xs[0], b-i * Wide2, container);
                p2 = new MyPoint(Line1xs[1], b-i * Wide2, container);
                line = new MyLine(p1, p2, container);
                listLines.Add(line);
            }
          
            return listLines;
            
        }

        public override List<MyLine> GetQiTaLines(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }

        public override void GetNameTextDic(MyAutoCadObjectBase container, out Dictionary<string, MyText> NameDic, out Dictionary<string, MyText> TextDic)
        {
            MyPoint p1;
            MyText text;
            MyJkbText1 jkbText;
            NameDic = new Dictionary<string, MyText>();
            TextDic = new Dictionary<string, MyText>();
            double[] w = new double[] {Wide1,Wide2,Wide3 };
            #region 设置NameDic
            p1 =new MyPoint(Liexs[2],0-Wide2,container);
            text=new MyText (p1,JkName[0],container);
            NameDic.Add(JkName[0], text);
            p1=new MyPoint(Liexs[6],0-Wide1,container);
            text=new MyText (p1,JkName[1],container);
            NameDic.Add(JkName[1], text);
            int j = 1;
            for (int i = 2; i < JkName.Length; i++)
            {
                if (++j == 6||j==8)
                {
                    j++;
                }
                p1 = new MyPoint(Liexs[j-2], 0-Wide1-Wide2, container);
                text = new MyText(p1, JkName[i], container);
                NameDic.Add(JkName[i], text);
            }
            #endregion
            #region 设置TextDic
            for (int i = 0; i < JkbItemCount; i++)
            {
                jkbText = new MyJkbText1();
                jkbText.SetData(i, JkbItemCount, Wide3, Liexs, container,w);
                TextDic.Add(i.ToString(), jkbText);
            }
            #endregion
        }

        public override System.Drawing.Rectangle GetRectangle(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }
        #endregion
    }
    public class MyXmlTableJkb2 : MyXmlTableJkb
    {
        public MyXmlTableJkb2(int count)
            : base(count)
        {
        }
        #region 接口
        public override List<MyLine> GetLieLines(MyAutoCadObjectBase container)
        {
            MyPoint p1, p2;
            MyLine line;
            List<MyLine> listLine = new List<MyLine>();
            double a = Wide1 + Wide2;
            for (int i = 0; i < Liexs.Length; i++)
            {
                switch (i)
                {
                    case 0:
                    case 8:
                        p1 = new MyPoint(Liexs[i], 0, container);
                        p2 = new MyPoint(Liexs[i], 0 - (2*Wide3 * JkbItemCount + a), container);
                        line = new MyLine(p1, p2, container);
                        break;
                    case 4:
                    case 6:
                        p1 = new MyPoint(Liexs[i], 0 - a, container);
                        p2 = new MyPoint(Liexs[i], (0 - a) - (2*Wide3 * JkbItemCount), container);
                        line = new MyLine(p1, p2, container);
                        break;
                    default:
                        p1 = new MyPoint(Liexs[i], 0 - Wide1, container);
                        p2 = new MyPoint(Liexs[i], (0 - Wide1) - (2*Wide3 * JkbItemCount + Wide2), container);
                        line = new MyLine(p1, p2, container);
                        break;
                }
                listLine.Add(line);
            }
            return listLine;
        }

        public override List<MyLine> GetHangLines(MyAutoCadObjectBase container)
        {
            List<MyLine> listLines = new List<MyLine>();
            MyLine line;
            MyPoint p1, p2;
            p1 = new MyPoint(Line1xs[0], 0, container);
            p2 = new MyPoint(Line1xs[1], 0, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            p1 = new MyPoint(Line1xs[0], 0 - Wide1, container);
            p2 = new MyPoint(Line1xs[1], 0 - Wide1, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            p1 = new MyPoint(Line1xs[0], 0 - Wide1 - Wide2, container);
            p2 = new MyPoint(Line1xs[1], 0 - Wide1 - Wide2, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            double b = 0 - Wide1 - Wide2;
            for (int i = 0; i < JkbItemCount ; i++)
            {
                p1 = new MyPoint(Line2xs[0], b-(i * (Wide3*2)+Wide3), container);
                p2 = new MyPoint(Line2xs[1], b - (i * (Wide3 * 2) + Wide3), container);
                line = new MyLine(p1, p2, container);
                listLines.Add(line);
                p1 = new MyPoint(Line1xs[0], b-(i * (Wide3*2)+2*Wide3), container);
                p2 = new MyPoint(Line1xs[1], b-(i * (Wide3*2)+2*Wide3), container);
                line = new MyLine(p1, p2, container);
                listLines.Add(line);
            }
          
            return listLines;
            
        }

        public override List<MyLine> GetQiTaLines(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }

        public override void GetNameTextDic(MyAutoCadObjectBase container, out Dictionary<string, MyText> NameDic, out Dictionary<string, MyText> TextDic)
        {
            MyPoint p1;
            MyText text;
            MyJkbText2 jkbText;
            NameDic = new Dictionary<string, MyText>();
            TextDic = new Dictionary<string, MyText>();
            double[] w = new double[] { Wide1, Wide2, Wide3 };
            #region 设置NameDic
            p1 = new MyPoint(Liexs[2], 0-Wide2, container);
            text = new MyText(p1, JkName[0], container);
            //m_jdqTextDic.Add(JkName[0],text);
            NameDic.Add(JkName[0], text);
            p1 = new MyPoint(Liexs[6], 0-Wide1, container);
            text = new MyText(p1, JkName[1], container);
            NameDic.Add(JkName[1], text);
            int j = 1;
            for (int i = 2; i < JkName.Length; i++)
            {
                if (++j == 6 || j == 8)
                {
                    j++;
                }
                p1 = new MyPoint(Liexs[j - 2], 0-Wide1-Wide2, container);
                text = new MyText(p1, JkName[i], container);
                // m_jdqTextDic.Add(JkName[i], text);
                NameDic.Add(JkName[i], text);
            }
            #endregion
            #region 设置TextDic
            for (int i = 0; i < JkbItemCount; i++)
            {
                jkbText = new MyJkbText2();
                jkbText.SetData(i, JkbItemCount, 2*Wide3, Liexs, container,w);
                TextDic.Add(i.ToString(), jkbText);
            }
            #endregion
        }

        public override System.Drawing.Rectangle GetRectangle(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }
        #endregion
    }
    public class MyXmlTableJkb3 : MyXmlTableJkb
    {
        public MyXmlTableJkb3(int count)
            : base(count)
        {
        }
        #region 接口
        public override List<MyLine> GetLieLines(MyAutoCadObjectBase container)
        {
            MyPoint p1, p2;
            MyLine line;
            List<MyLine> listLine = new List<MyLine>();
            double a = Wide1 + Wide2;
            for (int i = 0; i < Liexs.Length; i++)
            {
                switch (i)
                {
                    case 0:
                    case 8:
                        p1 = new MyPoint(Liexs[i], 0, container);
                        p2 = new MyPoint(Liexs[i], 0 - (3*Wide3 * JkbItemCount + a), container);
                        line = new MyLine(p1, p2, container);
                        break;
                    case 4:
                    case 6:
                        p1 = new MyPoint(Liexs[i], 0 - a, container);
                        p2 = new MyPoint(Liexs[i], (0 - a) - (3*Wide3 * JkbItemCount), container);
                        line = new MyLine(p1, p2, container);
                        break;
                    default:
                        p1 = new MyPoint(Liexs[i], 0 - Wide1, container);
                        p2 = new MyPoint(Liexs[i], (0 - Wide1) - (3*Wide3 * JkbItemCount + Wide2), container);
                        line = new MyLine(p1, p2, container);
                        break;
                }
                listLine.Add(line);
            }
            return listLine;
        }

        public override List<MyLine> GetHangLines(MyAutoCadObjectBase container)
        {
            List<MyLine> listLines = new List<MyLine>();
            MyLine line;
            MyPoint p1, p2;
            p1 = new MyPoint(Line1xs[0], 0, container);
            p2 = new MyPoint(Line1xs[1], 0, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            p1 = new MyPoint(Line1xs[0], 0 - Wide1, container);
            p2 = new MyPoint(Line1xs[1], 0 - Wide1, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            p1 = new MyPoint(Line1xs[0], 0 - Wide1 - Wide2, container);
            p2 = new MyPoint(Line1xs[1], 0 - Wide1 - Wide2, container);
            line = new MyLine(p1, p2, container);
            listLines.Add(line);
            double b = 0 - Wide1 - Wide2;
            for (int i = 0; i < JkbItemCount ; i++)
            { 
                p1 = new MyPoint(Line2xs[0], b-(i * (Wide3 * 3) + Wide3), container);
                p2 = new MyPoint(Line2xs[1], b-(i * (Wide3 * 3) + Wide3), container);
                line = new MyLine(p1, p2, container);
                listLines.Add(line);
                p1 = new MyPoint(Line2xs[0], b-(i * (Wide3 * 3) + 2*Wide3), container);
                p2 = new MyPoint(Line2xs[1], b-(i * (Wide3 * 3) + 2*Wide3), container);
                line = new MyLine(p1, p2, container);
                listLines.Add(line);
                p1 = new MyPoint(Line1xs[0], b - (i * (Wide3 * 3)+3*Wide3), container);
                p2 = new MyPoint(Line1xs[1], b - (i * (Wide3 * 3)+3*Wide3), container);
                line = new MyLine(p1, p2, container);
                listLines.Add(line);
            }
            return listLines;            
        }

        public override List<MyLine> GetQiTaLines(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }

        public override void GetNameTextDic(MyAutoCadObjectBase container, out Dictionary<string, MyText> NameDic, out Dictionary<string, MyText> TextDic)
        {
            MyPoint p1;
            MyText text;
            MyJkbText3 jkbText;
            NameDic = new Dictionary<string, MyText>();
            TextDic = new Dictionary<string, MyText>();
            double[] w = new double[] { Wide1, Wide2, Wide3 };
            #region 设置NameDic
            p1 = new MyPoint(Liexs[2], 0-Wide2, container);
            text = new MyText(p1, JkName[0], container);
            NameDic.Add(JkName[0], text);
            p1 = new MyPoint(Liexs[6], 0-Wide1, container);
            text = new MyText(p1, JkName[1], container);
            NameDic.Add(JkName[1], text);
            int j = 1;
            for (int i = 2; i < JkName.Length; i++)
            {
                if (++j == 6 || j == 8)
                {
                    j++;
                }
                p1 = new MyPoint(Liexs[j - 2], 0-Wide1-Wide2, container);
                text = new MyText(p1, JkName[i], container);
                // m_jdqTextDic.Add(JkName[i], text);
                NameDic.Add(JkName[i], text);
            }
            #endregion
            #region 设置TextDic
            for (int i = 0; i < JkbItemCount; i++)
            {
                jkbText = new MyJkbText3();
                jkbText.SetData(i, JkbItemCount, 3*Wide3, Liexs, container,w);
                TextDic.Add(i.ToString(), jkbText);
            }
            #endregion
        }

        public override System.Drawing.Rectangle GetRectangle(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }
        #endregion
    }
    public class MyXmlDyHuan : IMyInterface
    {
        string[] str = new string[] {"name","no" };
        XmlElement m_xmlRoot;
        public XmlElement XmlRoot
        {
            get { return m_xmlRoot; }
            set { m_xmlRoot = value; }
        }
        double m_Width;

        public double Width
        {
            get { return m_Width; }
            set { m_Width = value; }
        }
        double m_Heigh;

        public double Heigh
        {
            get { return m_Heigh; }
            set { m_Heigh = value; }
        }
      
        public MyXmlDyHuan()
        {
            GetDataFromXml();
        }
        public XmlElement GetXmlRoot()
        {
            if (XmlRoot == null)
            {
                XmlDocument xmlDoc = new XmlDocument();
                string filename = System.IO.Directory.GetCurrentDirectory() + "\\DyFile1.xml";
                xmlDoc.Load(filename);
                XmlRoot = xmlDoc.DocumentElement;
            }
            return XmlRoot;
        }
        #region 接口
        public string FileName
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public virtual List<MyLine> GetLieLines(MyAutoCadObjectBase container)
        {
            List<MyLine> listLines = new List<MyLine>();
            MyLine line;
            MyPoint p1, p2;
            for (int i = 1; i >=0; i--)
            {
                p1 = new MyPoint(i * Width, container.Top- 0, container);
                p2 = new MyPoint(i * Width, container.Top - Heigh, container);
                line = new MyLine(p1, p2, container);
                listLines.Add(line);
               
            }
            return listLines;
        }

        public virtual List<MyLine> GetHangLines(MyAutoCadObjectBase container)
        {
            List<MyLine> listLines = new List<MyLine>();
            MyLine line;
            MyPoint p1, p2;
            for (int i = 1; i >= 0; i--)
            {
                p1 = new MyPoint(0, container.Top - i * Heigh, container);
                p2 = new MyPoint(Width, container.Top - i * Heigh, container);
                line = new MyLine(p1, p2, container);
                listLines.Add(line);
            }
            return listLines;
        }

        public List<MyLine> GetQiTaLines(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }

        public virtual void GetNameTextDic(MyAutoCadObjectBase container, out Dictionary<string, MyText> m_jdqNameDic, out Dictionary<string, MyText> m_jdqTextDic)
        {
            m_jdqNameDic = new Dictionary<string, MyText>();
            m_jdqTextDic = new Dictionary<string, MyText>();
            MyPoint p1 = new MyPoint(0.1, container.Top - 4, container);
            MyPoint p2 = new MyPoint(0.1, container.Top - 8, container);
            MyText name = new MyText(p1, "名称");
            MyText cardno = new MyText(p2, "板号：");
            m_jdqNameDic.Add(str[0], name);
            m_jdqNameDic.Add(str[1], cardno);
        }

        public System.Drawing.Rectangle GetRectangle(MyAutoCadObjectBase container)
        {
            throw new NotImplementedException();
        }

        public virtual void GetDataFromXml()
        {
            if (XmlRoot == null)
            {
                GetXmlRoot();
            }
        }
        #endregion
    }
}
